# AprilTag Recognizer

A small python program that uses [syndicate-py](https://git.syndicate-lang.org/syndicate-lang/syndicate-py) to run an OpenCV + apriltag detector thread and asserts any apriltag detections to a [Dataspace](https://synit.org/book/glossary.html#dataspace)

![A screenshot showing the opencv program running in one window, with a tracking marking in the center of the apriltag. Two other terminal windows are open, one showing a stream of lines that display publishing info about where the apriltag is on the screen. The other terminal window shows the output of a program which is listening to these publishing events.](apriltag-recognizer-demo.png)

## Demo

A demo program for listening to the apriltag assertions is included in `listener.py`

To run the full demo, first start a Dataspace. I use the `syndicate-server`. You can install this dataspace server impl using the following commands:

```Bash
git clone https://git.syndicate-lang.org/syndicate-lang/syndicate-rs
cd syndicate-rs
cargo build --release
./target/release/syndicate-server -c dev-scripts/benchmark-config.pr
```

In a new terminal, run the recognizer NOTE: This will open your webcam if available!
```python
python3 apriltag.py
```

Then in yet another terminal, run the listener:
```python
python3 listener.py
```

Now when you put a `tagStandard52h13` apriltag in webcam range, the recognizer should start asserting the tag's location. If you do not have a printer available, I found it's easy to simply navagate to the [apriltag website](https://april.eecs.umich.edu/software/apriltag) on a mobile device, zoom in on the tagStandard25h13 tag on the homepage and hold your phone screen to the camera.

